package com.taijia.chapter8;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.PrintStream;

/**
 * Created by taijia on 2015/1/31.
 */
public class TestPrintStream1 {
    public static void main(String[] args) {
        PrintStream ps = null;
        try {
            FileOutputStream fos = new FileOutputStream("E:/myeclipse2014/Workspaces/2014/msb_basic/src/com/taijia/chapter8/TestBufferStream2.txt");
            ps = new PrintStream(fos);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        if (ps != null)
            System.setOut(ps); // 打到文件上去
        int ln = 0;
        for (char c = 0; c < 60000; c++) {
            System.out.print(c + " ");
            if (ln++ >= 100) {
                ln = 0;
                System.out.println();
            }

        }
    }
}
